﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileUploader.aspx.cs" Inherits="HU8.Web.FileExplorer.FileExplorer.FileUploader" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   
    <script type="text/javascript">
        var lang = {};
    </script>
    <!-- JQuery -->
   <%-- <script type="text/javascript" src="Scripts/jquery-1.6.4.min.js"></script>--%>
    <script src="../js/jquery-1.8.3.js" type="text/javascript"></script>
 
    <!-- Load plupload and all it's runtimes and finally the jQuery queue widget -->
  <%--  <link type="text/css" rel="Stylesheet" href="Scripts/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css"/>
    <script type="text/javascript" src="Scripts/plupload/plupload.full.js"></script>
    <script type="text/javascript" src="Scripts/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
    <script type="text/javascript" src="Scripts/plupload/i18n/<%: config.Language %>.js"></script>--%>


    <link href="../js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css" rel="stylesheet" type="text/css" />
    <script src="../js/plupload/plupload.full.js" type="text/javascript"></script>
    <script src="../js/plupload/jquery.plupload.queue/jquery.plupload.queue.js" type="text/javascript"></script>
    <script src="../js/plupload/i18n/zh.js" type="text/javascript"></script>


    <script type="text/javascript">
        //var resize, max_file_size, url, filters
        <asp:Literal ID="litScript" runat="server" />
    </script>
    <script type="text/javascript">
        // Convert divs to queue widgets when the DOM is ready
        $(function () {
            var uploader = $("#uploader").pluploadQueue({
                // General settings
                runtimes: 'gears,flash,silverlight,html5',
                url: url,
                max_file_size: max_file_size,
                chunk_size: '2mb',
                unique_names: false, //使用原来的名字
                // Resize images on clientside if we can
                //resize: { width: 320, height: 240, quality: 90 },
                // Specify what files to browse for
                filters: filters,
                // Flash settings
                flash_swf_url: '../js/plupload/plupload.flash.swf',
                // Silverlight settings
                silverlight_xap_url: '../js/plupload/plupload.silverlight.xap',
                init: {
                    UploadComplete: function () {
                        if (window.parent != null) {
                            window.parent.filemanager.reload(); //刷新列表
                        }
                    },
                    ChunkUploaded: function (up, res) {
                       
                    },
                    Error: function (up, error) {
                      
                    }
                }
            });

            // Client side form validation
            $('form').submit(function (e) {
                // Files in queue upload them first
                if (uploader.files.length > 0) {
                    // When all files are uploaded submit form
                    uploader.bind('StateChanged', function () {
                        if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
                            $('form')[0].submit();
                        }
                    });
                    uploader.start();
                } else {
                    
                }
                return false;
            });
        });

    </script>
</head>
<body >
    <form id="form1" runat="server" >
	    <div id="uploader">
            <p>加载中，请稍等</p> 
	    </div>
    </form>
</body>
</html>